﻿using WenAntdUI.Helps;
using WenAntdUI.Services;

namespace WenAntdUI.Dome
{
    public partial class MainForm : MenuForm
    {
        public MainForm(IdentityService identity, MenuService menu)
        {
            InitializeComponent();

            if (identity.SysUser != null)
            {
                if (identity.SysUser.Icon != null)
                {
                    this.UserInfoImage = ImageHelp.GetImage(identity.SysUser.Icon);
                }
                this.UserInfoDisplayName = identity.DisplayName;
                this.UserInfoIconSize = new Size(26, 26);
            }

            var steebutton = new AntdUI.Button()
            {
                IconSvg = "SettingOutlined",
                Dock = DockStyle.Right,
                Width = 40,
            };
            steebutton.Click += (s, e) => new Settings.SettingsForm().ShowDialog();
            this.TopControls.Add(steebutton);

            this.StartPosition = FormStartPosition.CenterScreen;
            this.Size = new Size(1280, 790);

            //this.SetMenuTabs(menu.GetMenuTagItemsAll());
            this.SetMenuTabs(menu.GetUserMenuTagItems());
        }
    }
}
